Add pre-condition check on nullable argument
authorEmmanuele Bassi <ebassi@gnome.org>
Sun, 28 Jun 2020 12:40:11 +0000 (13:40 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Sun, 28 Jun 2020 12:42:03 +0000 (13:42 +0100)
Even if `gtk_expression_watch()` will do the same, we're calling public
API, so we should perform a check at the point of use, to ensure that
warnings are easily debuggable.

gtk/gtkexpression.c

index 750ee2c57c86e4ff4ebc196315fb5662051f2a70..a3ba536afafeb56c556a4deaa23eff884b3d038b 100644 (file)
@@ -1992,6 +1992,8 @@ gtk_expression_bind (GtkExpression *self,
   g_return_val_if_fail (GTK_IS_EXPRESSION (self), NULL);
   g_return_val_if_fail (G_IS_OBJECT (target), NULL);
   g_return_val_if_fail (property != NULL, NULL);
+  g_return_val_if_fail (this_ == NULL || G_IS_OBJECT (this_), NULL);
+
   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (target), property);
   if (G_UNLIKELY (pspec == NULL))
     {